package com.itheima.homework;

public class Test7 {
    public static void main(String[] args) {
        int[] arr = {1, 3, 5, 7, 9};
        System.out.println("数组中最大值为: " + max(arr));
    }

    public static int max(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }
}
